package com.example.lib_cache.service;


import com.example.lib_cache.model.Application;
import com.example.lib_cache.model.Guide;
import com.example.lib_cache.model.Navigation;
import com.example.lib_cache.model.Order;
import com.example.lib_cache.model.OrderWithNav;
import com.example.lib_cache.model.Passwords;
import com.example.lib_cache.model.PhoneAndNickName;
import com.example.lib_cache.model.User;
import com.example.lib_cache.model.response.ResponseResult;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;

public interface ApiService {

    //登录
    @POST("/user/login")
    Observable<ResponseResult<String>> login(@Body RequestBody requestBody);

    //注册
    @POST("/user/register")
    Observable<ResponseResult<Long>> register(@Body User user);

    //获取网易云信令牌
    @GET("/netease/getNeteaseToken")
    Observable<ResponseResult<String>> getIMToken();

    //根据token获取用户信息
    @POST("/user/getUserInfo")
    Observable<ResponseResult<User>> getUserInfoByToken();

    //发送订单
    @POST("/navigation/sendingOrder/{num}")
    Observable<ResponseResult<String>> sendingOrder(@Body Navigation navigation, @Path("num") int num);

    //获取刚发出订单的状态
    @POST("/order/getSendingOrder")
    Observable<ResponseResult<Order>> getSendingOrderStatus();

    //获取用户正在进行的导航信息
    @GET("/navigation/getWaitingNavigation")
    Observable<ResponseResult<Navigation>> getWaitingNavigation();

    //根据订单id获取司机位置
    @POST("/guide/getDriverLocation/{orderId}")
    Observable<ResponseResult<Guide>> getDriverLocation(@Path("orderId") Long orderId);

    //根据获取当前订单的司机用户名
    @GET("/user/getDriverUserName")
    Observable<ResponseResult<String>> getDriverUserName();

    //乘客确认上车，修改订单状态
    @POST("/order/orderWithPickUp/{orderId}")
    Observable<ResponseResult<Long>> orderWithPickUp(@Path("orderId") Long orderId);

    //乘客确认下车，修改订单状态、导航状态
    @POST("/order/orderWithGetOff/{orderId}")
    Observable<ResponseResult<Long>> orderWithGetOff(@Path("orderId") Long orderId);

    //修改昵称或手机号
    @POST("/user/updateUserInfo")
    Observable<ResponseResult<String>> updateUserInfo(@Body PhoneAndNickName userInfo);

    //修改密码
    @POST("/user/changePassword")
    Observable<ResponseResult<String>> changePassword(@Body Passwords passwords);

    //获取历史订单
    @GET("/navigation/getPassengerAllOrderNav")
    Observable<ResponseResult<List<OrderWithNav>>> getHistoryOrders();

    //根据userid获取用户信息
    @GET("/user/getUser/{driverId}")
    Observable<ResponseResult<User>> getUser(@Path("driverId") Long driverId);


    //根据司机用户id获取其车辆信息
    @GET("/application/getDriverCarInfo/{driverId}")
    Observable<ResponseResult<Application>> getDriverCarInfo(@Path("driverId") Long driverId);


}
